//
//  ViewController.m
//  calculator
//
//  Created by 楼楚 on 15/9/22.
//  Copyright © 2015年 Chu Lou. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
   }
- (void) compute
{
//    1.取得文本框内容
    NSString *n1 = self.num1.text;
    NSString *n2 = self.num2.text;
//    2.将内容相加
    
    int result = n1.intValue + n2.intValue;
    
//    3.显示结果
    self.resultLabel.text = [NSString stringWithFormat:@"%d",result];
//    4. 关闭键盘 谁申请 谁释放； 谁打开，谁关闭。
//    FirstResponder :  光标所在文本框
//    [self.num1 resignFirstResponder];
//    [self.num2 resignFirstResponder];
//让视图关闭键盘
    [self.view endEditing:YES];
    
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
